<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>侧边栏菜单</title>
  <link rel="stylesheet" href="global.css">
  <style>
    /* 引入在线字体设置 */
    @import url('https://fonts.googleapis.com/css?family=Varela+Round');

    html,
    body {
      overflow-x: hidden;
      height: 100%;
    }

    body {
      background: #fff;
      padding: 0;
      margin: 0;
      font-family: 'Varela Round', sans-serif;
    }

    .header {
      display: block;
      margin: 0 auto;
      width: 100%;
      max-width: 100%;
      box-shadow: none;
      background-color: #FC466B;
      position: fixed;
      height: 60px !important;
      overflow: hidden;
      z-index: 10;
    }

    .main {
      margin: 0 auto;
      display: block;
      height: 100%;
      margin-top: 60px;
    }

    .mainInner {
      display: table;
      height: 100%;
      width: 100%;
      text-align: center;
    }

    .mainInner div {
      display: table-cell;
      vertical-align: middle;
      font-size: 3em;
      font-weight: bold;
      letter-spacing: 1.25px;
    }

    /* 默认防止屏幕左侧 */
    #sidebarMenu {
      height: 100%;
      position: fixed;
      left: 0;
      width: 250px;
      margin-top: 60px;
      transform: translateX(-250px);
      transition: transform 250ms ease-in-out;
      background: linear-gradient(180deg, #FC466B 0%, #3F5EFB 100%);
    }

    .sidebarMenuInner {
      margin: 0;
      padding: 0;
      border-top: 1px solid rgba(255, 255, 255, 0.10);
    }

    .sidebarMenuInner li {
      list-style: none;
      color: #fff;
      /* 元素文本大写 */
      text-transform: uppercase;
      font-weight: bold;
      padding: 20px;
      cursor: pointer;
      border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    }

    .sidebarMenuInner li span {
      display: block;
      font-size: 14px;
      color: rgba(255, 255, 255, 0.50);
    }

    .sidebarMenuInner li a {
      color: #fff;
      text-transform: uppercase;
      font-weight: bold;
      cursor: pointer;
      text-decoration: none;
    }

    /* 模拟菜单图标被点击 侧边栏从左侧滑出*/
    input[type="checkbox"]:checked~#sidebarMenu {
      transform: translateX(0);
    }

    input[type=checkbox] {
      transition: all 0.3s;
      box-sizing: border-box;
      display: none;
    }

    .sidebarIconToggle {
      cursor: pointer;
      position: absolute;
      z-index: 99;
      height: 100%;
      width: 100%;
      top: 22px;
      left: 15px;
      height: 22px;
      width: 22px;
    }

    .spinner {
      transition: all 0.3s;
      box-sizing: border-box;
      position: absolute;
      height: 3px;
      width: 100%;
      background-color: #fff;
    }

    .horizontal {
      position: relative;
      float: left;
      margin-top: 3px;
    }

    .diagonal.part-1 {
      position: relative;
      float: left;
    }

    .diagonal.part-2 {
      position: relative;
      float: left;
      margin-top: 3px;
    }

    /* 当点击模拟菜单图标区域 中间横条完全透明*/
    input[type=checkbox]:checked~.sidebarIconToggle>.horizontal {
      opacity: 0;
    }

    /* 上面横条顺时针旋转135度 */
    input[type=checkbox]:checked~.sidebarIconToggle>.diagonal.part-1 {
      transform: rotate(135deg);
      margin-top: 8px;
    }

    /* 下面横条顺时针旋转135度 */
    input[type=checkbox]:checked~.sidebarIconToggle>.diagonal.part-2 {
      transform: rotate(-135deg);
      margin-top: -9px;
    }
  </style>
</head>

<body>
  <!-- 头部区域 -->
  <div class="header"></div>
  <!-- 假/隐藏复选框用作单击接收器，因此可以在其上使用：checked选择器 -->
  <input type="checkbox" class="openSidebarMenu" id="openSidebarMenu">
  <!-- 可以模拟一个菜单图标 通过样式实现菜单效果和X效果的切换 -->
  <!-- 当点击该 label 区域，触发 checkbox 的 checked 事件，通过:checked选择器使侧边菜单显示-->
  <label for="openSidebarMenu" class="sidebarIconToggle">
    <div class="spinner diagonal part-1"></div>
    <div class="spinner horizontal"></div>
    <div class="spinner diagonal part-2"></div>
  </label>
  <!-- 菜单 默认隐藏在视图左侧 -->
  <div id="sidebarMenu">
    <ul class="sidebarMenuInner">
      <li>Jelena Jovanovic <span>Web Developer</span></li>
      <li><a href="https://vanila.io" target="_blank">Company</a></li>
      <li><a href="https://instagram.com/plavookac" target="_blank">Instagram</a></li>
      <li><a href="https://twitter.com/plavookac" target="_blank">Twitter</a></li>
      <li><a href="https://www.youtube.com/channel/UCDfZM0IK6RBgud8HYGFXAJg" target="_blank">YouTube</a></li>
      <li><a href="https://www.linkedin.com/in/plavookac/" target="_blank">Linkedin</a></li>
      <li><a href="https://codepen.io/plavookac/pen/qomrMw" target="_blank">来源网站点这里</a></li>
    </ul>
  </div>
  <!-- 主体区域 -->
  <div id='center' class="main center">
    <div class="mainInner">
      <div>纯CSS侧边栏切换菜单</div>
    </div>
    <div class="mainInner">
      <div>纯CSS侧边栏切换菜单</div>
    </div>
    <div class="mainInner">
      <div></div>纯CSS侧边栏切换菜单
    </div>
  </div>
  </div>
</body>

</html>